<?php

//没有登录的	
if(empty($_GET['userinfo'])){
  header('location:http://api.hbsshop.cn/openid/getinfo.php?redirect_uri=http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
  exit();
} 
//登录后信息
$wxinfo = json_decode($_GET['userinfo'],true);

//判断是否登录成功
if(!empty($wxinfo['errcode'])){
  die('<script>window.location.href="/"</script>');
}

$openid = $wxinfo['openid'];
//本地数据
$localinfo = json_decode(file_get_contents("./user.json"),true);

if(empty($localinfo[$openid])){
  //添加用户
  $localinfo[$openid] = [
    'nickname'   =>$wxinfo['$nickname'],
    'headimgurl' => $wxinfo['headimgurl']
  ];

  // 写入数据
  file_put_contents('./user.json',json_encode($localinfo));
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="http://cdnjs.loli.net/ajax/libs/mdui/0.4.1/css/mdui.min.css">
    <script src="http://cdnjs.loli.net/ajax/libs/mdui/0.4.1/js/mdui.min.js"></script>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <title>我就是药神-高清在线播放</title>
</head>
<body class="mdui-theme-primary-pink">
      

    <div class="doc-example-demo">
        <div class="mdui-appbar" style="position: relative;">
          <div class="mdui-toolbar mdui-color-theme">
            <a href="javascript:;" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">menu</i></a>
            <a href="javascript:;" class="mdui-typo-headline">我就是药神</a>
            <div class="mdui-toolbar-spacer"></div>
            <a href="javascript:mdui.alert('当前为测试版,搜索功能即将开放!');" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">search</i></a>
            <a href="javascript:location=location;" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">refresh</i></a>
            <!-- <a href="javascript:;" class="mdui-btn mdui-btn-icon"><i class="mdui-icon material-icons">more_vert</i></a> -->
          </div>
        </div>
      </div>

		<div style="position:relative " >
      <video id="video"  class="mdui-video-fluid" controls src="http://cdn.xqmag.cn/uploads/20180718/a1e46c115365b0c5d5f33ea34fc1cb20.mp4"></video>
			<img id="gg"  style="position:absolute;z-index:9999;width:100%;top:0;height:100%" src="./timg.jpg">
		</div>
	
   
            <button  id="play" onclick="bf()" class="mdui-btn mdui-btn-raised mdui-btn-dense mdui-color-theme mdui-ripple mdui-m-a-3">裤子已脱,开始吧</button>
         

     
    
    <div class="mdui-p-x-2">     
      <h4 class="doc-article-title">ta们已经单手拿着手机观看完了 <a class="doc-anchor" id="event"></a></h4>
      <!-- 最近基佬 -->
      <div class="doc-example">
       
          <ul class="mdui-list" style="max-width: 500px;">

            
            <?php foreach($localinfo as $v): ?>
            <li style="float:left;" class="mdui-list-item  mdui-p-x-1">
              <div class="mdui-list-item-avatar"><img src="<?=$v['headimgurl']?>"></div>
      
            </li>  
            
      <?php endforeach;?>


          </ul>
        </div>
    </div>
    
      </div>
</body>
</html>
<script>
 

    function bf(){
	
    var audio = document.getElementById('video'); 
    if(audio!==null){             
        //检测播放是否已暂停.audio.paused 在播放器播放时返回false.


        if(audio.paused)
        {	
		$("#gg").hide();
            $("#play").html('休息一会!');
        }else{
		$("#gg").show();
            $("#play").html('继续来吧!');
        }
    if(audio.paused)                     {                 
        audio.play();//audio.play();// 这个就是播放  

    }else{
    audio.pause();// 这个就是暂停
    }
    } 
	

}
	function fullScreen() {
      var el = document.documentElement;
      var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
      if (typeof rfs != "undefined" && rfs) {
          rfs.call(el);
      } else if (typeof window.ActiveXObject != "undefined") {
          // for Internet Explorer
          var wscript = new ActiveXObject("WScript.Shell");
          if (wscript != null) {
              wscript.SendKeys("{F11}");
          }
      }
 
  }
</script>